package c_6_1_4;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * IO 操作频繁的任务
 *
 * @author lfg
 * @version 1.0
 */
public class FullIOTask implements Runnable {
    @Override
    public void run() {


        while (true) {
            try {
                FileOutputStream fileOutputStream = new FileOutputStream("tempFile.txt");
                for (int i = 0; i < 10000; i++) {
                    fileOutputStream.write(i);
                }
                fileOutputStream.close();

                FileInputStream fileInputStream = new FileInputStream("tempFile.txt");
                while (fileInputStream.read() != -1) {

                }

            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
